|
|
|
|
|
|
|
4. Create a new form (frmZipCity) and add a field for ZIP code and a field for City. Set the Tag property of these two textboxes to ZIP and City, respectively. |
|
|
|
|
|
|
|
|
5. Add a control array to this form. Do this by adding a command button, naming it cmdBtn, and then copying and pasting it seven times. |
|
|
|
|
|
|
|
|
6. Make the following variable declarations in the General Declaration of your form: |
|
|
|
|
|
|
|
|
Option Explicit
Dim dbFile As DATABASE
Dim cDBName As String
Dim rsFile As Recordset
Dim cRSName As String
Dim nBtnAlign As Integer
Dim nResult As Integer |
|
|
|
|
|
|
|
|
7. Add the following procedure to your form: |
|
|
|
|
|
|
|
|
Sub StartProc()
'
' open db and rs
'
' on error goto StartProcErr
'
cDBName = App.Path + "\master.mdb"
cRSName = "ZipCity"
'
nResult = RSOpen(cDBName, cRSName, dbOpenDynaset, dbFile, rsFile)
If nResult = recOK Then
nResult = RecInit(Me)
End If
'
If nResult = recOK Then
nResult = RecRead(Me, rsFile)
End If
'
GoTo StartProcExit
'
StartProcErr:
RecError Err, Error$, "StartProc"
GoTo StartProcExit
'
StartProcExit:
'
End Sub |
|
|
|
|
|
|
|
|
8. Add the following to the frmZipCity Form_Load event: |
|
|
|
|
|
|
|
|
Private Sub Form_Load()
' initialize and start up
'
StartProc ' open files
nResult = RecEnable(Me, False) ' turn off controls
nBtnAlign = btnAlignBottom ' set alignment var
BtnBarInit Me, nBtnAlign ' create button set
BtnBarEnable Me, "11111111" ' enable all buttons
End Sub |
|
|
|
|
|